/*
 * @Author: YNT 2501512800@qq.com
 * @Date: 2022-08-06 23:09:23
 * @LastEditors: YNT 2501512800@qq.com
 * @LastEditTime: 2022-08-06 23:38:58
 * @FilePath: \20220806后台\src\utils\validate.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/**
 * Created by PanJiaChen on 16/11/18.
 */

/**
 * @param {string} path
 * @returns {Boolean}
 */
export function isExternal(path) {
  return /^(https?:|mailto:|tel:)/.test(path);
}

/**
 * @param {string} str
 * @returns {Boolean}
 */
export function validUsername(str) {
  const valid_map = ["admin", "editor"];
  return valid_map.indexOf(str.trim()) >= 0;
}
// 仅限数字、中文、英文、"_"、"-"、"."
export const regName = /^[a-zA-Z0-9-_.\u4e00-\u9fa5]+$/;
// 手机
export const regPhone = /^1(3|4|5|6|7|8|9)\d{9}$/;
// 邮箱
export const regEmail =
  /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/;
// 身份证 18位
export const regIDCard =
  /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}(\d|[xX])$/;
